import requests
from enum import Enum

class Client():
    REMOTE = Enum("MODEL",{
        'LOCAL':{'url':'http://127.0.0.1:11434', 'name':'deepseek-r1:1.5b'},
        'DEEPSEEK':{'url':'https://api.deepseek.com', 'name':'deepseek-v3'}
    })

    def __init__(self, key, model):
        self.client = OpenAI(api_key=key, base_url=model.value['url'])
        self.model = model

    def chat(self, messages:list):
        response = self.client.chat.completions.create(
            model=self.model.value['name'],
            messages=messages,
            stream=True,
            temperature=1.5,
            max_tokens=500
            )
        response = requests.post(
    "http://localhost:11434/api/chat",
    json={
        "model": "deepseek-coder",
        "messages": [
            {
                "role": "user",
                "content": "你好,你能帮我写一段 Python 代码吗?"
            }
        ]
    }
)
        return response
